defmodule ChoicePlayground.Choice do
  alias ChoicePlayground.{Questionnaire, Question, QuestionContent, Repo, ErrorView}

  def add_fill_content(content, question_id) do
    Repo.insert! %QuestionContent{
      seq: 0,
      count: 0,
      content: String.trim(content),
      question_id: question_id,
    }
  end

  def update_select_content(content) do
    content
    |> QuestionContent.changeset(%{count: (content.count + 1)})
    |> Repo.update!()
  end
end